/*
2021-11-20
https://www.acwing.com/problem/content/4078/
*/
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
const int N=2e5+5;
int p[N];
int n,m,k;
int col[N];
int cnt[N];
vector<int> s[N];

int find(int x)
{
    if(x!=p[x]) p[x]=find(p[x]);
    return p[x];
}

int main()
{
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++) p[i]=i;
    for(int i=1;i<=n;i++) cin>>col[i];
    
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        p[find(a)]=find(b);
    }
    
    for(int i=1;i<=n;i++) s[find(i)].push_back(i);
    
    int res=0;
    for(int i=1;i<=n;i++)
        if(s[i].size())
        {
            int t=0;
            for(auto x:s[i]) t=max(t,++cnt[col[x]]);
            res+=s[i].size()-t;
            for(auto x:s[i]) --cnt[col[x]];
        }
    
    cout<<res<<endl;
    
    return 0;
}
